package com.smart.community.region.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.smart.community.region.entity.ResidentHousehold;
import com.smart.community.region.vo.ResidentHouseholdVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 住户房户关联Mapper接口
 * 
 * @author Wu.Liang
 * @since 2025-07-28
 */
@Mapper
public interface ResidentHouseholdMapper extends BaseMapper<ResidentHousehold> {
    
    /**
     * 查询房户住户列表（包含住户信息）
     * @param householdId 房户ID
     * @return 住户房户关联VO列表
     */
    List<ResidentHouseholdVO> selectResidentListWithInfo(@Param("householdId") Long householdId);
    
    /**
     * 查询住户的房户列表（包含房户信息）
     * @param residentId 住户ID
     * @return 住户房户关联VO列表
     */
    List<ResidentHouseholdVO> selectHouseholdListWithInfo(@Param("residentId") Long residentId);
    
    /**
     * 检查住户是否已在房户中
     * @param residentId 住户ID
     * @param householdId 房户ID
     * @return 数量
     */
    Integer checkResidentInHousehold(@Param("residentId") Long residentId, @Param("householdId") Long householdId);
    
    /**
     * 根据房户ID和住户ID查询关联信息
     * @param householdId 房户ID
     * @param residentId 住户ID
     * @return 关联信息
     */
    ResidentHousehold selectByHouseholdAndResident(@Param("householdId") Long householdId, @Param("residentId") Long residentId);
} 